﻿using System;
using System.Collections.Generic;
using System.Text;
using SIOsystem.Model.ClassifyDataSetTableAdapters;

namespace SIOsystem.Control
{
    class DeptClass
    {
        static public bool addDepartment(string deptName)
        {
            try
            {
                using (DepartmentTableAdapter db = new DepartmentTableAdapter())
                {
                    if (db.InsertDepartment(deptName, 0)>0)
                    {
                        return true;
                    } 
                    else
                    {
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("增加部门出错", ex);
            }
        }

        static public bool modDepartment(string deptName,long DID)
        {
            try
            {
                using (DepartmentTableAdapter db = new DepartmentTableAdapter())
                {
                    if (db.UpdateDepartment(deptName, 0,DID) > 0)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("修改部门出错", ex);
            }
        }
    }
}
